<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .bgc{
        background-color: red;
    }
</style>
<body>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

    <!-- 监听子组件事件 -->
    <div id="app">
        <div :style="{fontSize:blogFontSize+'em'}">
            <blog v-for="item in arr" :blog="item" :key="item.id" @ctn-click="blogFontSize+=1"></blog>
        </div>    
    </div>

    <script>
        Vue.component('blog',{  
            props:['blog'],         
            template:`
            <div>
                <h3>{{blog.title}}</h3>   
                <button @click="$emit('ctn-click')">放大字体</button>
            </div>
            `
        })
        let aaa=new Vue({
            el:'#app',
            data:{
                blogFontSize:1,
                arr:[
                    {
                        id:1,
                        title:'低头思故乡',
                    },
                ]
            },
            methods:{
                ttnclick:function(){
                    console.log(999);
                    this.blogFontSize+=1
                }
            }
        })
    </script>

</body>
</html>